<template>
    <div class="xl-table">
        <div class="until" style="display: flex;justify-content: flex-end;">
            <a-select v-model="queryParam.filterWithMode" @change="pageOnload" placeholder="标签筛选" showSearch allowClear  style="margin-right: 16px;width: 200px;">
                <a-select-option value="1">
                    团队转化
                </a-select-option>
                <a-select-option value="2">
                    科技中小
                </a-select-option>
                <a-select-option value="3">
                    高企
                </a-select-option>
                <a-select-option value="4">
                    上市企业
                </a-select-option>
                <a-select-option value="5">
                    有投融资
                </a-select-option>
                <a-select-option value="6">
                    有孵化基金
                </a-select-option>
                <a-select-option value="7">
                    有市级扶持资金
                </a-select-option>
                <a-select-option value="8">
                    新增在孵企业
                </a-select-option>
                <a-select-option value="9">
                    新增毕业企业
                </a-select-option>
                <a-select-option value="10">
                    当年在孵企业
                </a-select-option>
            </a-select>
        </div>
        <div class="xl-table-content">
            <xlTable
                    :queryParam="queryParam"
                    :columns="columns"
                    :dataSource="data"
                    rowKey="id"
                    :pagination="pagination"
                    :loading="loading"
                    @change="handleTableChange"
                    bordered
                    :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}">
                >
                <template v-slot:action="scope">
                    <a @click="(e)=>{
                        e.target.style.color='#999'
                        seeForm(scope.record)
                    }">查看</a>
                </template>
                <template v-slot:dupliCnt="scope">
                    <a @click="seeCodeForm(scope.record)" v-if="scope.record.dupliCnt">{{scope.record.dupliCnt | xln}}</a>
                    <span v-else>{{scope.record.dupliCnt | xln}}</span>

                </template>
            </xlTable>
        </div>
        <seeForm ref="seeForm"></seeForm>
        <hatch_company_creditCode  ref="hatch_company_creditCode"></hatch_company_creditCode>
    </div>
</template>

<script>

    import xlMixin from '../../../components/mixin/index'
    import seeForm from '@/views/admin/carrier/hatch_company/model/see'
    import hatch_company_creditCode from './hatch_company_creditCode'
    export default {
        name: "index",
        mixins: [xlMixin],
        data() {
            return {
                columns: [
                    {
                        title: '序号',
                        key: 'rowIndex',
                        align: "center",
                        fixed: 'left',
                        width: '100px',
                        sorter: (a) => a.id,//排序
                        customRender: function (t, r, index) {
                            return parseInt(index) + 1;
                        }
                    },
                    {
                        title: '企业名称',
                        dataIndex: 'comName',
                        fixed: 'left',
                        width:'175px',
                        type: 'input'
                    },
                    {
                        title: '重复挂靠',
                        dataIndex: 'dupliCnt',
                        fixed: 'left',
                        width:'175px',
                        type:'input.number',
                        scopedSlots: {customRender: 'dupliCnt'},
                    },
                    {
                        title: '入驻时间',
                        dataIndex: 'joinDate',
                        type: 'date'
                    },
                    {
                        title: '行业领域',
                        dataIndex: 'industryDomain',
                        type: 'input'
                    },
                    {
                        title: '企业标签',
                        dataIndex: 'tagNames',
                        type: 'input'
                    },
                    {
                        title: '员工人数',
                        dataIndex: 'employeeNum',
                        type: 'input'
                    },
                    {
                        title: '是否空挂',
                        dataIndex: 'isEmptyHanging',
                        type:'radio',
                        typeData:[
                            {
                                dataName:'是',
                                dataValue:true
                            },
                            {
                                dataName:'否',
                                dataValue:false
                            }
                        ]
                    },

                    {
                        title: '销售收入(万元)',
                        dataIndex: 'incomeAmt',
                        type: 'input'
                    },
                    {
                        title: '纳税额(万元)',
                        dataIndex: 'taxAmt',
                        type: 'input'
                    },
                    {
                        title: '自主知识产权申报量',
                        dataIndex: 'iprGrantNum',
                        type: 'input'
                    },
                    {
                        title: '自主知识产权授权量',
                        dataIndex: 'iprOwnedNum',
                        type: 'input'
                    },
                    {
                        title: '企业状态',
                        dataIndex: 'statusDesc',
                        type: 'input'
                    },
                    {
                        title: '操作',
                        dataIndex: 'action',
                        align: "center",
                        fixed: 'right',
                        width: '150px',
                        scopedSlots: {customRender: 'action'},
                    }
                ],
                url: {
                    list: "/carrier/api/carrierComInfo/pageList",
                    add: '/carrier/api/carrierComMore/save',
                    edit: '/carrier/api/carrierComMore/save',
                    delete: "/carrier/api/carrierComInfo/remove",
                    deleteBatch: "/carrier/api/carrierComInfo/remove",
                    exportXlsUrl: "/carrier/api/carrierComInfo/exportExcel",
                    importExcelUrl: "/carrier/api/carrierComInfo/importExcel",
                    importExcelDemoUrl: "/carrier/api/carrierComInfo/importTemplate",
                }
            }
        },
        components: {
            seeForm,
            hatch_company_creditCode
        },
        props:{
            carrierId:Number,
            filterYear:String
        },
        created() {
            this.paramMore.carrierId = this.carrierId
            this.paramMore.filterYear = this.filterYear
            this.queryParam.filterWithMode = undefined
            this.formatMerge()
            this.pageOnload()
        },
        methods: {
            editForm(data) {
                //修改方法
                this.$refs.xlForm.tableTitle = '修改'
                this.$refs.xlForm.formatForm(data)
                this.$refs.xlForm.confirmLoading = false
                this.$refs.xlForm.type = 2
            },
            seeCodeForm(data){
               this.$refs.hatch_company_creditCode.formatData(data)
            }
        },
        watch:{
            carrierId(){
                this.paramMore.carrierId = this.carrierId
                this.paramMore.filterYear = this.filterYear
                this.queryParam.filterWithMode = undefined
                this.pagination.current = 1
                this.pageOnload()
            },
            filterYear(){
                this.paramMore.carrierId = this.carrierId
                this.paramMore.filterYear = this.filterYear
                this.queryParam.filterWithMode = undefined
                this.pagination.current = 1
                this.pageOnload()
            }
        }
    }
</script>

<style scoped lang="less">
    .xl-table {
        .xl-table-content {
            padding: 16px;
        }
    }
</style>
